home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / prog / dnalib59.arj / POPWIND.BAS < prev    next >
BASIC Source File  |  1994-01-21  |  4KB  |  109 lines

  1. DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
  2.  
  3. SUB POPWIND (Title$,Toprow%,Leftcolumn%,Bottomrow%,Rightcolumn%,Attr%,Shadow%,Border%) PUBLIC
  4.  
  5. CalcByte Attr%,FGround%,BGround%
  6.  
  7. SELECT CASE Border%
  8.         CASE 1
  9.           Tlc% = 218:Lbs% = 180:Rbs% = 195:Trc% = 191  'single line border
  10.           Sds% = 179
  11.           Blc% = 192:Tbs% = 196:Brc% = 217
  12.  
  13.         CASE 2
  14.           Tlc% = 201:Lbs% = 181:Rbs% = 198:Trc% = 187  'double line border
  15.           Sds% = 186
  16.           Blc% = 200:Tbs% = 205:Brc% = 188
  17.  
  18.         CASE 3
  19.           Tlc% = 213:Lbs% = 181:Rbs% = 198:Trc% = 184  'single sides double top
  20.           Sds% = 179                                 'and bottom
  21.           Blc% = 212:Tbs% = 205:Brc% = 190
  22.  
  23.         CASE 4
  24.           Tlc% = 214:Lbs% = 180:Rbs% = 195:Trc% = 183  'double sides single top
  25.           Sds% = 186                                 'and bottom
  26.           Blc% = 211:Tbs% = 196:Brc% = 189
  27.  
  28.         CASE ELSE
  29.           Tlc% = 32:Lbs% = 32:Rbs% = 32:Trc% = 32    'plain border
  30.           Sds% = 32
  31.           Blc% = 32:Tbs% = 32:Brc% = 32
  32.  
  33. END SELECT
  34.  
  35.  
  36. COLOR Fground%,Bground%
  37. LOCATE Toprow%,Leftcolumn%,0
  38. W$ = STRING$(((Rightcolumn% - Leftcolumn%) - 1), Tbs%)
  39.  
  40. '┌─────────────────────────────────────────────────────────────────────┐
  41. '│  The following block of code looks to see if you want a Title and   │░░
  42. '│  then check it's length, and the width of the window to see if it   │░░
  43. '│  will fit with even spacing and will append a period to the end of  │░░
  44. '│  the Title to keep everything centred.                              │░░
  45. '└─────────────────────────────────────────────────────────────────────┘░░
  46. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  47.  
  48. IF LEN(Title$) THEN
  49.   Title$ = CHR$(32) + Title$ + CHR$(32)
  50.   a% = ((Rightcolumn% - Leftcolumn%) - 1) - (LEN(Title$) + 2)
  51.   b% = a% \ 2
  52.   c% = a% - b%
  53.   T$ = STRING$(b%,Tbs%) + CHR$(Lbs%) + Title$ + CHR$(Rbs%) + STRING$(c%,Tbs%)
  54.   PRINT CHR$(Tlc%) + T$ + CHR$(Trc%);
  55. ELSE
  56.   PRINT CHR$(Tlc%) + W$ + CHR$(Trc%);
  57. END IF
  58.  
  59. '┌─────────────────────────────────────────────────────────────────────┐
  60. '│   The FOR NEXT loop simply fills in the centre of the window and    │░░
  61. '│   then the bottom line is PRINTed.                                  │░░
  62. '└─────────────────────────────────────────────────────────────────────┘░░
  63. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  64.  
  65. Row% = Toprow%
  66.  
  67. FOR i = Toprow% TO Bottomrow% - 2
  68.   IF Row% <= Bottomrow% - 1 THEN
  69.     INCR Row%
  70.     LOCATE Row%, Leftcolumn%,0
  71.     PRINT CHR$(Sds%) + SPACE$((Rightcolumn% - Leftcolumn%) - 1) + CHR$(Sds%);
  72.   END IF
  73. NEXT i
  74.  
  75. LOCATE Row% + 1, Leftcolumn%,0
  76. PRINT CHR$(Blc%) + W$ + CHR$(Brc%);
  77.  
  78. '┌─────────────────────────────────────────────────────────────────────┐
  79. '│   The final block of code is for PRINTing the shadow, the cursor    │░░
  80. '│   is LOCATEd and the SCREEN function is used to get the character,  │░░
  81. '│   the character is then placed into Shd1-2-3 and is then PRINTed    │░░
  82. '│   with a different attribute to give a transparent effect.          │░░
  83. '└─────────────────────────────────────────────────────────────────────┘░░
  84. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  85.  
  86. IF Shadow% = 1 THEN
  87.   COLOR 7,0
  88.   Row% = Toprow%
  89.   FOR j = Toprow% TO Bottomrow%
  90.     IF Row% < Bottomrow% + 1 THEN
  91.       INCR Row%
  92.       LOCATE Row%, Rightcolumn% + 1,0
  93.       Shd1% = SCREEN(Row%,Rightcolumn% + 1)
  94.       Shd2% = SCREEN(Row%,Rightcolumn% + 2)
  95.       PRINT CHR$(Shd1%) + CHR$(Shd2%);
  96.     END IF
  97.   NEXT j
  98.   Br% = Bottomrow% + 1
  99.   Lc% = Leftcolumn% + 2
  100.   FOR k% = 1 TO Rightcolumn% - Leftcolumn%
  101.     Shd3% = SCREEN(Br%,Lc%)
  102.     LOCATE Br%,Lc%,0
  103.     PRINT CHR$(Shd3%);
  104.     INCR Lc%
  105.   NEXT k%
  106. END IF
  107.  
  108. END SUB
  109.